package com.lemon.funplus.cheanh;

import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class EraserSizeSeekbarListener implements OnSeekBarChangeListener {
	EraserSettingDialog frag;
	int maxRadius;

	public EraserSizeSeekbarListener(EraserSettingDialog frag) {
		this.frag = frag;
	}

	@Override
	public void onStopTrackingTouch(SeekBar seekBar) {
	}

	@Override
	public void onStartTrackingTouch(SeekBar seekBar) {
	}

	@Override
	public void onProgressChanged(SeekBar seekBar, int progress,
			boolean fromUser) {
		this.maxRadius = ((EraserSettingDialog) frag).eraserIndicator.maxRadius;
		if (maxRadius > 0) {
				EraserSettingDialog frag = ((EraserSettingDialog) this.frag);
				frag.setEraseRadius((int) ((progress / 100.0f) * (maxRadius - 1)) + 1);
				frag.updateRadius();
		}
	}
}
